<template>
  <div class="index">
    <!-- 跑马灯  -->
    <div>
      <el-carousel :interval="4000" type="card" height="200px">
        <el-carousel-item v-for="item in imgList" :key="item.id">
          <img :src="item.idView" class="image" @click="goPage(item.id)">
        </el-carousel-item>
      </el-carousel>
    </div>
  </div>
</template>

<script>
export default {

  name: 'card',
  data() {
    return {
      imgList: [
        {id: 0, idView: '/img/1663908434694.png'},
        {id: 1, idView: '/img/illust_101570636_20220929_212234.png'},
        {id: 2, idView: '/img/1660375209339.png'},
        {id: 3, idView: '/img/1653477825930.jpg'},
        {id: 4, idView: '/img/hua.png'},
      ],
    }
  },
  methods:{
    goPage (id) {
      if (id == 1) {
        window.location.href = "https://www.bilibili.com/";
      } else if (id == 2) {
        window.location.href = "https://www.bilibili.com/";
      } else if (id == 3) {
        window.location.href = "https://www.bilibili.com/";
      } else if (id == 4) {
        window.location.href = "https://www.bilibili.com/";
      } else if (id == 5) {
        window.location.href = "https://www.bilibili.com/";
      }
    },
  }
}
</script>



<style scoped>
.el-carousel__item h3 {
  color: #475669;
  font-size: 14px;
  opacity: 0.75;
  line-height: 200px;
  margin: 0;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n+1) {
  background-color: #d3dce6;
}
img{
  /*设置图片宽度和浏览器宽度一致*/
  width:100%;
  height:auto;
}
</style>